/*
 * Copyright (c) www.bugull.com
 */

package com.bugull.farm.core.handler;

import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleStateEvent;

/**
 *
 * @author Frank Wen(xbwen@hotmail.com)
 */
public class FarmIdleChannelHandler extends ChannelInboundHandlerAdapter {
    
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        if(evt instanceof IdleStateEvent){
            ctx.close();
        }else{
            super.userEventTriggered(ctx, evt);
        }
    }

}
